#include "head.h"

char pMessageBuffer[1024*1024];

/* The contents under 'path' are stored in pMessageBuffer. */
void PrintDir(char *path)
{
	DIR *dp;
	struct dirent *dirp;
	char str[255];

	if((dp=opendir(path)) == NULL)
	{
		fprintf(stderr, "Bad Path to Print Dir.\a\n");
		return;
	}

	pMessageBuffer[0] = '\0';

	while((dirp=readdir(dp)) != NULL)
	{
		strcpy(str, dirp->d_name);
		strcat(str, "\n");
		strcat(pMessageBuffer, str);
	}

	closedir(dp);
}


int main()
{
	char path[255];
	char buf[1024];
	size_t size = 1024;
	
	puts("Input the path:");
	gets(path);
	
	chdir(path);	
	getcwd(buf, size);
	printf("cwd: %s\n", buf);	
	exit(0);
}
   

